*******Tough Enough: How Militarism Affects Leaders Differently*******
*******TIMMERMAN 2021*******
MERGING_________________________________________________________________________
open "WHY LEADERS FIGHT MONADIC REPLICATION"
browse
drop teacher journalism	law medicine religion activist careerpolitician creative business aristocratlandowner interpreter bluecollar scienceeng married marriedinpower divorced totalspouses childtotal parstability orphanbinary illegit royalty treatment
merge m:1 ccode year using "C:\Users\Matthew\OneDrive for Business\globalstudiesquarterly\quant.data\pwt_cow.dta"
merge m:1 ccode year using "C:\Users\Matthew\OneDrive for Business\globalstudiesquarterly\quant.data\welfarespending.dta"

keep if _merge ==3  
drop _merge
keep if sparta == 1

duplicates report
sort ccode year
quietly by ccode year: gen dup = cond(_N==1,0,_n)
tabulate dup
drop if dup>1

MAIN CONTROLS________________________________________________________________________
merge m:1 ccode year using "C:\Users\Matthew\OneDrive for Business\globalstudiesquarterly\quant.data\nmc5.dta"
merge m:1 ccode year using "C:\Users\Matthew\OneDrive for Business\globalstudiesquarterly\quant.data\borders"

keep if _merge ==3  
drop _merge

keep if year == 1989 | year == 1999
keep if ccode == 315 | ccode == 160 | ccode == 740 | ccode == 370 | ccode == 155 | ccode == 230 | ccode == 2 | ccode == 2 | ccode == 70 | ccode == 317 | ccode == 380 | ccode == 710 | ccode == 475 | ccode == 20 | ccode == 560 | ccode == 732 | ccode == 290 | ccode == 640
edit 

CODING__________________________________________________________________________
generate militarytogdp =.
replace militarytogdp = milex/gdpnational
replace militarytogdp = . if militarytogdp < 0
generate militaryvswelfare =.
replace militaryvswelfare = militarytogdp/imputedwelfspend

sum militaryvswelfare, detail 
tabstat militaryvswelfare, stats(n mean median min max)
tabstat militarytogdp, stats(n mean median min max)
tabstat imputedwelfspend, stats(n mean median min max)
tabstat year, stats (n mean median min max)
drop if militaryvswelfare == 0

generate sparta =.
replace sparta = 1 if militaryvswelfare >= 0.0015478 
replace sparta = 0 if militaryvswelfare < 0.0015478
generate athens=.
replace athens = 1 if militaryvswelfare < 0.0015478
replace athens = 0 if militaryvswelfare >= 0.0015478

generate civilian =.
replace civilian = 1 if milservice == 0
replace civilian = 0 if milservice == 1
generate military =.
replace military = 1 if milservice == 1
replace military = 0 if milservice == 0
generate dove =.
replace dove = 1 if milservice == 0
replace dove = 0 if milservice == 1
generate eagle =.
replace eagle = 1 if milservice == 1 & milnoncombat == 0
replace eagle = 0 if milservice == 1 & milnoncombat == 1
replace eagle = 0 if milservice == 0 
generate hawk =.
replace hawk = 1 if milservice == 1 & milnoncombat == 1
replace hawk = 0 if milservice == 1 & milnoncombat == 0
replace hawk = 0 if milservice == 0 

generate civilianathens =.
replace civilianathens = 1 if athens == 1  & milservice == 0
replace civilianathens = 0 if athens == 1  & milservice == 1
replace civilianathens = 0 if athens == 0  
generate civiliansparta =.
replace civiliansparta = 1 if sparta == 1  & milservice == 0
replace civiliansparta = 0 if sparta == 1  & milservice == 1
replace civiliansparta = 0 if sparta == 0  
generate militaryathens =.
replace militaryathens = 1 if athens == 1  & milservice == 1
replace militaryathens = 0 if athens == 1  & milservice == 0
replace militaryathens = 0 if athens == 0  
generate militarysparta =.
replace militarysparta = 1 if sparta == 1  & milservice == 1
replace militarysparta = 0 if sparta == 1  & milservice == 0
replace militarysparta = 0 if sparta == 0  
generate doveinathens =.
replace doveinathens = 1 if athens == 1  & dove == 1
replace doveinathens = 0 if athens == 1  & dove == 0
replace doveinathens = 0 if athens == 0  
generate doveinsparta =.
replace doveinsparta = 1 if sparta == 1  & dove == 1
replace doveinsparta = 0 if sparta == 1  & dove == 0
replace doveinsparta = 0 if sparta == 0 
generate eagleinathens =.
replace eagleinathens = 1 if athens == 1 & eagle == 1
replace eagleinathens = 0 if athens == 1 & eagle == 0
replace eagleinathens = 0 if athens == 0 
generate eagleinsparta =.
replace eagleinsparta = 1 if sparta == 1 & eagle == 1
replace eagleinsparta = 0 if sparta == 1 & eagle == 0
replace eagleinsparta = 0 if sparta == 0 
generate hawkinathens =.
replace hawkinathens = 1 if athens == 1 & hawk == 1
replace hawkinathens = 0 if athens == 1 & hawk == 0
replace hawkinathens = 0 if athens == 0 
generate hawkinsparta =.
replace hawkinsparta = 1 if sparta == 1 & hawk == 1
replace hawkinsparta = 0 if sparta == 1 & hawk == 0
replace hawkinsparta = 0 if sparta == 0 

generate coldwar =.
replace coldwar = 1 if year <= 1991 
replace coldwar = 0 if year > 1991
sum year, detail 
tabstat year, stats(n mean median min max)

merge m:1 ccode year using "C:\Users\Matthew\OneDrive for Business\globalstudiesquarterly\quant.data\ddtrimmed.dta"
generate dictator =.
replace dictator = 0 if regime == 0
replace dictator = 0 if regime == 1
replace dictator = 0 if regime == 2
replace dictator = 1 if regime == 3
replace dictator = 1 if regime == 4
replace dictator = 1 if regime == 5

generate leader_setting =.
replace leader_setting = 1 if doveinathens == 1
replace leader_setting = 2 if doveinsparta == 1
replace leader_setting = 3 if eagleinathens == 1
replace leader_setting = 4 if eagleinsparta == 1
replace leader_setting = 5 if hawkinathens == 1
replace leader_setting = 6 if hawkinsparta == 1

Alternative Measure for Militarism (Military Personnel Relative Population)
replace milper = . if milper < 0
generate mil_pop = milper/tpop 
sum mil_pop, detail 
tabstat mil_pop, stats(n mean median min max)
generate athensversion2=.
replace athens = 1 if mil_pop < 0.0049739 
replace athens = 0 if mil_pop >= 0.0049739 
generate spartaversion2 =.
replace sparta = 1 if mil_pop >= 0.0049739 
replace sparta = 0 if mil_pop < 0.0049739 

keep if ccode == 620

TESTS___________________________________________________________________________
sum militaryvswelfare, detail 
median militaryvswelfare
tabstat militaryvswelfare, stats(n mean median min max)
tabstat tau_lead, stats(n mean median min max)

count if athens == 1
count if sparta == 1
count if dove == 1
count if eagle == 1
count if hawk == 1
count if doveinathens == 1
count if doveinsparta == 1
count if eagleinathens == 1
count if eagleinsparta == 1
count if hawkinathens == 1
count if hawkinsparta == 1
count if milservice == 1
count if milservice == 0 
count if civilian == 1
count if military == 1
count if militaryathens == 1
count if civilianathens == 1
count if militarysparta == 1
count if civiliansparta == 1

count if cwinit == 1
count if athens == 1 & cwinit == 1
count if sparta == 1 & cwinit == 1
count if dove == 1 & cwinit == 1
count if eagle == 1 & cwinit == 1
count if hawk == 1 & cwinit == 1
count if doveinathens == 1 & cwinit == 1
count if doveinsparta == 1 & cwinit == 1
count if eagleinathens == 1 & cwinit == 1
count if eagleinsparta == 1 & cwinit == 1
count if hawkinathens == 1 & cwinit == 1
count if hawkinsparta == 1 & cwinit == 1
count if civilian == 1 & cwinit == 1
count if military == 1 & cwinit == 1
count if militaryathens == 1 & cwinit == 1 
count if civilianathens == 1 & cwinit == 1
count if militarysparta == 1 & cwinit == 1
count if civiliansparta == 1 & cwinit == 1
count if regime == 4
count if militarysparta == 1 & regime == 5
count if militarysparta == 1 & regime == 3 & cwinit == 1
count if militarysparta == 1 & regime == 4 
count if milservice == 0 & regime == 4
keep if milservice == 0 & regime == 4
count if hawkinsparta == 1 & regime == 3 
count if hawkinsparta == 1 & regime == 4 
count if hawkinsparta == 1 & regime == 5 
count if hawkinsparta == 1 & regime == 3 & cwinit == 1
count if hawkinsparta == 1 & regime == 4 & cwinit == 1
count if hawkinsparta == 1 & regime == 5 & cwinit == 1
count if regime == 3 & cwinit == 1
count if regime == 4 & cwinit == 1
count if regime == 5 & cwinit == 1

ttest cwinit, by (athens)
ttest cwinit, by (sparta)
ttest cwinit, by (dove)
ttest cwinit, by (eagle)
ttest cwinit, by (hawk)
ttest cwinit, by (doveinathens)
ttest cwinit, by (doveinsparta)
ttest cwinit, by (eagleinathens)
ttest cwinit, by (eagleinsparta)
ttest cwinit, by (hawkinathens)
ttest cwinit, by (hawkinsparta)
ttest cwinit, by (milservice)
ttest cwinit, by (militaryathens)
ttest cwinit, by (civilianathens)
ttest cwinit, by (militarysparta)
ttest cwinit, by (civiliansparta)
ttest militaryvswelfare, by (milservice)
ttest cinc, by (milservice)
ttest militarytogdp, by (milservice)
ttest militarytogdp, by (doveinathens)
ttest militarytogdp, by (doveinsparta)
ttest militarytogdp, by (eagleinathens)
ttest militarytogdp, by (eagleinsparta)
ttest militarytogdp, by (hawkinathens)
ttest militarytogdp, by (hawkinsparta)
ttest tau_lead, by (military)
ttest tau_lead, by (civilian)

Clarify_________________________________________________________________________
. net from https://gking.harvard.edu/clarify/
listcoef
listcoef, help

*Model 1: Civilian vs. Military
Civilian in Athens Missing Category
estsimp logit cwinit civiliansparta militaryathens militarysparta cinc borders dictator age tau_lead coldwar leaderpeaceyears leaderpeaceyears2 leaderpeaceyears3, cluster(ccode)
setx civiliansparta 1 militaryathens 0 militarysparta 0
setx civiliansparta 0 militaryathens 1 militarysparta 0
setx civiliansparta 0 militaryathens 0 militarysparta 1
simqi

estsimp logit cwinit civilianathens civiliansparta militaryathens cinc borders dictator age tau_lead coldwar leaderpeaceyears leaderpeaceyears2 leaderpeaceyears3, cluster(ccode)
setx civilianathens 1 civiliansparta 0 militaryathens 0 
simqi

drop b1 
drop b2
drop b3
drop b4 
drop b5 
drop b6 
drop b7
drop b8
drop b9
drop b10
drop b11
drop b12
drop b13
drop b14
drop b15

*Model 2: Leader-Setting Types
Dove in Athens Missing Category
estsimp logit cwinit doveinsparta eagleinathens eagleinsparta hawkinathens hawkinsparta cinc borders dictator age tau_lead coldwar leaderpeaceyears leaderpeaceyears2 leaderpeaceyears3, cluster(ccode)
setx doveinsparta 1 eagleinathens 0 eagleinsparta 0 hawkinathens 0 hawkinsparta 0 
setx doveinsparta 0 eagleinathens 1 eagleinsparta 0 hawkinathens 0 hawkinsparta 0  
setx doveinsparta 0 eagleinathens 0 eagleinsparta 1 hawkinathens 0 hawkinsparta 0  
setx doveinsparta 0 eagleinathens 0 eagleinsparta 0 hawkinathens 1 hawkinsparta 0 
setx doveinsparta 0 eagleinathens 0 eagleinsparta 0 hawkinathens 0 hawkinsparta 1 
simqi

estsimp logit cwinit doveinathens doveinsparta eagleinathens eagleinsparta hawkinathens cinc borders dictator age tau_lead coldwar leaderpeaceyears leaderpeaceyears2 leaderpeaceyears3, cluster(ccode)
setx doveinathens 1 doveinsparta 0 eagleinathens 0 eagleinsparta 0 hawkinathens 0  
simqi 

drop b1 
drop b2
drop b3
drop b4 
drop b5 
drop b6 
drop b7
drop b8
drop b9
drop b10
drop b11
drop b12
drop b13
drop b14
drop b15

*Model 3: Military Dictatorship
keep if dictator == 1
estsimp logit cwinit civiliansparta militaryathens militarysparta cinc borders age tau_lead coldwar leaderpeaceyears leaderpeaceyears2 leaderpeaceyears3, cluster(ccode)
setx civiliansparta 1 militaryathens 0 militarysparta 0
setx civiliansparta 0 militaryathens 1 militarysparta 0
setx civiliansparta 0 militaryathens 0 militarysparta 1
simqi

estsimp logit cwinit civilianathens civiliansparta militaryathens cinc borders age tau_lead coldwar leaderpeaceyears leaderpeaceyears2 leaderpeaceyears3, cluster(ccode)
setx civilianathens 1 civiliansparta 0 militaryathens 0 
simqi

drop b1 
drop b2
drop b3
drop b4 
drop b5 
drop b6 
drop b7
drop b8
drop b9
drop b10
drop b11
drop b12
drop b13
drop b14

*Model 4: Percentage Increase 
logit cwinit i.leader_setting cinc borders dictator age tau_lead coldwar leaderpeaceyears leaderpeaceyears2 leaderpeaceyears3, cluster(ccode)
listcoef, percent
findit spost

drop b1 
drop b2
drop b3
drop b4 
drop b5 
drop b6 
drop b7
drop b8
drop b9
drop b10
drop b11
drop b12
drop b13
drop b14

*Robustness Checks
Military Leaders (Sparta) Across Six Regime Type Categories
count if regime == 5
count if militarysparta == 1 & regime == 0 cwinit == 1
Limiting Dataset to Autocracy
keep if dictator == 1
Limiting Dataset to Democracy 
keep if dictator == 0
Limiting Dataset to Military Regimes
keep if regime == 4

Alternative Measure for Militarism #1 (Sparta cases are top quartile for military-welfare ratio (i.e. higher threshold to be coded as militarized state)
generate athensalternate1 = . 
replace athensalternate1 = 1 if militaryvswelfare < 0.0034076
replace athensalternate1 = 0 if militaryvswelfare >= 0.0034076
generate spartaalternate1 =.
replace spartaalternate1 = 1 if mil_pop >= 0.0034076
replace spartaalternate1 = 0 if mil_pop < 0.0034076
generate civilianathensalternate1 =.
replace civilianathensalternate1 = 1 if athensalternate1 == 1  & milservice == 0
replace civilianathensalternate1 = 0 if athensalternate1 == 1  & milservice == 1
replace civilianathensalternate1 = 0 if athensalternate1 == 0  
generate civilianspartaalternate1 =.
replace civilianspartaalternate1 = 1 if spartaalternate1 == 1  & milservice == 0
replace civilianspartaalternate1 = 0 if spartaalternate1 == 1  & milservice == 1
replace civilianspartaalternate1 = 0 if spartaalternate1 == 0  
generate militaryathensalternate1 =.
replace militaryathensalternate1 = 1 if athensalternate1 == 1  & milservice == 1
replace militaryathensalternate1 = 0 if athensalternate1 == 1  & milservice == 0
replace militaryathensalternate1 = 0 if athensalternate1 == 0  
generate militaryspartaalternate1 =.
replace militaryspartaalternate1 = 1 if spartaalternate1 == 1  & milservice == 1
replace militaryspartaalternate1 = 0 if spartaalternate1 == 1  & milservice == 0
replace militaryspartaalternate1 = 0 if spartaalternate1 == 0  
generate doveinathensalternate1 =.
replace doveinathensalternate1 = 1 if athensalternate1 == 1  & dove == 1
replace doveinathensalternate1 = 0 if athensalternate1 == 1  & dove == 0
replace doveinathensalternate1 = 0 if athensalternate1 == 0  
generate doveinspartaalternate1 =.
replace doveinspartaalternate1 = 1 if spartaalternate1 == 1  & dove == 1
replace doveinspartaalternate1 = 0 if spartaalternate1 == 1  & dove == 0
replace doveinspartaalternate1 = 0 if spartaalternate1 == 0 
generate eagleinathensalternate1 =.
replace eagleinathensalternate1 = 1 if athensalternate1 == 1 & eagle == 1
replace eagleinathensalternate1 = 0 if athensalternate1 == 1 & eagle == 0
replace eagleinathensalternate1 = 0 if athensalternate1 == 0 
generate eagleinspartaalternate1 =.
replace eagleinspartaalternate1 = 1 if spartaalternate1 == 1 & eagle == 1
replace eagleinspartaalternate1 = 0 if spartaalternate1 == 1 & eagle == 0
replace eagleinspartaalternate1 = 0 if spartaalternate1 == 0 
generate hawkinathensalternate1 =.
replace hawkinathensalternate1 = 1 if athensalternate1 == 1 & hawk == 1
replace hawkinathensalternate1 = 0 if athensalternate1 == 1 & hawk == 0
replace hawkinathensalternate1 = 0 if athensalternate1 == 0 
generate hawkinspartaalternate1 =.
replace hawkinspartaalternate1 = 1 if spartaalternate1 == 1 & hawk == 1
replace hawkinspartaalternate1 = 0 if spartaalternate1 == 1 & hawk == 0
replace hawkinspartaalternate1 = 0 if spartaalternate1 == 0 

*Model 1 Alternate Militarism 1: Civilian vs. Military (Alternate 1)
Civilian in Athens Missing Category
estsimp logit cwinit civilianspartaalternate1 militaryathensalternate1 militaryspartaalternate1 cinc borders dictator age tau_lead coldwar leaderpeaceyears leaderpeaceyears2 leaderpeaceyears3, cluster(ccode)
setx civilianspartaalternate1 1 militaryathensalternate1 0 militaryspartaalternate1 0
setx civilianspartaalternate1 0 militaryathensalternate1 1 militaryspartaalternate1 0
setx civilianspartaalternate1 0 militaryathensalternate1 0 militaryspartaalternate1 1
simqi
estsimp logit cwinit civilianathensalternate1 civilianspartaalternate1 militaryathensalternate1 cinc borders dictator age tau_lead coldwar leaderpeaceyears leaderpeaceyears2 leaderpeaceyears3, cluster(ccode)
setx civilianathensalternate1 1 civilianspartaalternate1 0 militaryathensalternate1 0 
simqi
*Model 2 Alternate Militarism 1: Leader-Setting Types (Alternate 1)
Dove in Athens Missing Category
estsimp logit cwinit doveinspartaalternate1 eagleinathensalternate1 eagleinspartaalternate1 hawkinathensalternate1 hawkinspartaalternate1 cinc borders dictator age tau_lead coldwar leaderpeaceyears leaderpeaceyears2 leaderpeaceyears3, cluster(ccode)
setx doveinspartaalternate1 1 eagleinathensalternate1 0 eagleinspartaalternate1 0 hawkinathensalternate1 0 hawkinspartaalternate1 0 
setx doveinspartaalternate1 0 eagleinathensalternate1 1 eagleinspartaalternate1 0 hawkinathensalternate1 0 hawkinspartaalternate1 0  
setx doveinspartaalternate1 0 eagleinathensalternate1 0 eagleinspartaalternate1 1 hawkinathensalternate1 0 hawkinspartaalternate1 0  
setx doveinspartaalternate1 0 eagleinathensalternate1 0 eagleinspartaalternate1 0 hawkinathensalternate1 1 hawkinspartaalternate1 0 
setx doveinspartaalternate1 0 eagleinathensalternate1 0 eagleinspartaalternate1 0 hawkinathensalternate1 0 hawkinspartaalternate1 1 
simqi
estsimp logit cwinit doveinathensalternate1 doveinspartaalternate1 eagleinathensalternate1 eagleinspartaalternate1 hawkinathensalternate1 cinc borders dictator age tau_lead coldwar leaderpeaceyears leaderpeaceyears2 leaderpeaceyears3, cluster(ccode)
setx doveinathensalternate1 1 doveinspartaalternate1 0 eagleinathensalternate1 0 eagleinspartaalternate1 0 hawkinathensalternate1 0  
simqi 

Alternative Measure for Militarism #2 (Military Personnel Relative Population)
replace milper = . if milper < 0
generate mil_pop = milper/tpop 
sum mil_pop, detail 
tabstat mil_pop, stats(n mean median min max)
generate athensalternate2 =.
replace athensalternate2 = 1 if mil_pop < 0.0049739
replace athensalternate2 = 0 if mil_pop >= 0.0049739
generate spartaalternate2 =.
replace spartaalternate2 = 1 if mil_pop >= 0.0049739
replace spartaalternate2 = 0 if mil_pop < 0.0049739

Female Leaders Only
drop if gender == 1
count if civilianathens == 1
count if militaryathens == 1
count if civiliansparta == 1
count if militarysparta == 1
count if civilianathens == 1 & cwinit == 1
count if civiliansparta == 1 & cwinit == 1

DUPLICATES & MISCELLANEOUS COMMANDS______________________________________________________________________
duplicates report
sort ccode1 year leadername
quietly by ccode1 year leadername: gen dup = cond(_N==1,0,_n)
tabulate dup
drop if dup>1
sum tau_lead, detail
tension low
keep if tau_lead >= -0.053592
tension high
keep if tau_lead < -0.053592
